package com.xzs.service.impl;

import com.xzs.annaotation.XzsService;
import com.xzs.service.TimeService;

/**
 * Created by zs.xu on 2020/8/17.
 */
@XzsService("TimeService")
public class TimeServiceImpl implements TimeService {
    public String getOrderInfo() {
        long startTime=System.currentTimeMillis();
        //执行方法
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        long endTime=System.currentTimeMillis();
        float excTime=(float)(endTime-startTime)/1000;
        System.out.println("getOrderInfo 执行时间："+excTime+"s");
        return "getOrderInfo";
    }

    public String getUserInfo() {
        long startTime=System.currentTimeMillis();
        //执行方法
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        long endTime=System.currentTimeMillis();
        float excTime=(float)(endTime-startTime)/1000;
        System.out.println("getUserInfo 执行时间："+excTime+"s");
        return "getUserInfo";
    }

    public String getOtherInfo() {
        long startTime=System.currentTimeMillis();
        //执行方法
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        long endTime=System.currentTimeMillis();
        float excTime=(float)(endTime-startTime)/1000;
        System.out.println("getOtherInfo 执行时间："+excTime+"s");
        return "getOtherInfo";
    }
}
